import axios from "../config.js";

/**
 * 分页查询通行记录
 * @returns {Promise<unknown>}
 */
export const findPage = data => {
    return axios({
        url: "/demo/record/findByPage",
        method: "get",
        params: data
    });
};

export const findByPageByP_id = data => {
    return axios({
        url: "/demo/record/findByPageByP_id",
        method: "get",
        params: data
    });
};

export const findByPageByA_id = data => {
    return axios({
        url: "/demo/record/findByPageByA_id",
        method: "get",
        params: data
    });
};
/**
 * 查询所有通行记录
 * @returns {Promise<unknown>}
 */
export const findAll = data => {
    return axios({
        url: "/demo/record/findAllRecord",
        method: "post",
        params: data
    });
};

/**
 * 通过id查找单个通行记录
 * @returns {Promise<unknown>}
 */
export const findOne = (data) => {
    return axios({
        url: "/demo/record/findOne/" ,
        method: "post",
        data
    });
};



/**
 * 通过上传表格进行添加通行记录
 * @param data
 * @returns {Promise<unknown>}
 */
export const saveFromExcel = data => {
    return axios({
        url: "/demo/record/saveFromExcel",
        method: "post",
        data
    });
};
/**
 * 添加通行记录
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const save = data => {
    return axios({
        url: "/demo/record/save/" ,
        method: "post",
        data
    });
};
/**
 * 更改通行记录
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const update = data => {
    return axios({
        url: "/demo/record/update/" ,
        method: "post",
        data
    });
};

/**
 * 删除单条通行记录
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const del = (data) => {
    return axios({
        url: "/demo/record/delete/" ,
        method: "post",
        data
    });
};

/**
 * 删除选中通行记录
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const delMgs = data => {
    return axios({
        url: "/demo/record/deleteMessages" ,
        method: "post",
        data
    });
};
